<style>
    .events-list{
        max-height: 732px !important;
    }

    #body, .h-top{
        padding-top: 0 !important;
    }   
    
    .h-top{
        padding-bottom: 0 !important;
    }
</style>
<div id="body" class="layout profile-events">
    <div class="wrap">
        <div class="left">
            <ul class="sort-panel">
                <li class="s-text">Search events:</li>
                <li>
                    <a href="<?php echo $this->baseUrl(); ?>">
                        <span class="first">
                            <span class="last">
                                <span class="middle">
                                    Home
                                </span>
                            </span>
                        </span>
                    </a>
                </li>
                <li>
                    <a href="<?php echo $this->baseUrl("profile"); ?>" class="current selected">
                        <span class="first">
                            <span class="last">
                                <span class="middle">
                                    Profile
                                </span>
                            </span>
                        </span>
                    </a>
                </li>
            </ul>
            <div class="cf"></div>
            <div class="name"><strong><?php echo $this->first_name . " " . $this->last_name; ?></strong></div>
            <div class="profiles">
                <div class="infos fl" style="height: 162px;">
                    <div class="infoleft fl">
                        <p>Overall <strong>Rating</strong></p>
                        <div class="rates">
                            <span class="rating" rel="<?php echo $this->totalRating; ?>" id="<?php echo $this->user_id; ?>"></span>
                            <div class="cf"></div>
                            <p class="note"><?php echo $this->totalRating . " / " . RATING_STARS_MAX; ?> Average rating</p>
                        </div>
                        <p><br /><br /><br /></p>
                        <!--<p class="ismall"><span class="blu" style="margin-right: 6px;"><strong>Info:</strong></span><?php echo $this->user_bio; ?></p>-->
                    </div>
                    <div class="inforight fl">
                        <p>Published Events: <span class="blu"><strong><?php echo $this->published_events; ?></strong></span></p>
                        <p>Private: <span class="blu"><strong><?php echo $this->private_events; ?></strong></span></p>
                        <p>Public: <span class="blu"><strong><?php echo $this->public_events; ?></strong></span></p>
                        <p><br /></p>
                        <p>Attended Events: <span class="org"><?php echo $this->attended_events; ?></span></p>
                    </div>
                </div>
                <div class="avt fr">
                    <img src="<?php echo $this->member_image; ?>" alt="<?php echo $this->first_name . " " . $this->last_name; ?>" />
                </div>
                <div class="cf"></div>
                <?php
                    $x = new Zend_Auth_Storage_Session('User_Auth');
                    $y = $x->read();
//                    if ($x->read()->user_id != getEncryptedString($this->enc_user_id, "decode"))
//                    {
                    if ($this->isLoggedIn == "yes")
                    {
                        if ($x->read()->user_id != getEncryptedString($this->enc_user_id, "decode"))
                        {
                            //if user is logged in
                            ?>
                            <div class="change-options friend-rqst-btn">
                                <?php
                                if ($this->isFriend == "yes")
                                {

                                    //request accepted and both are friends already
                                    echo '<a href="' . $this->baseUrl("friend/remove?user_id=" . $this->enc_user_id) . '" onclick="return confirm(\'Are you sure?\');">Remove</a>';
                                }
                                else
                                {
                                    if ($this->requestPending == "yes")
                                    {
                                        //request sent but not accepted
                                        echo '<a href="' . $this->baseUrl("friend/remove?user_id=" . $this->enc_user_id) . '" onclick="return confirm(\'Are you sure to cancel request?\');">Request sent</a>';
                                    }
                                    else
                                    {
                                        echo '<a href="' . $this->baseUrl("friend/add?user_id=" . $this->enc_user_id) . '">Add as Friend</a>';
                                    }
                                }
                                ?>
                            </div>
                            <?php
                        }
                    }
                ?>
            </div>
            <div class="cf"></div>
            <div class="tabs">
                <ul class="tab-menu">
                    <?php
                        $event_active = "";
                        if ($this->mainTabClass == "events")
                        {
                            $event_active = "active";
                        }
                    ?>
                    <li class="<?php echo $event_active; ?>"><a href="#events">EVENTS</a></li>
                    <li class="rate <?php echo $this->user_id == $this->logged_in_user_id || $this->isLoggedIn == 'no' ? 'active' : ''; ?>"><a href="#ratings">RATINGS & COMMENTS</a></li>
                    <?php
                        if ($this->isLoggedIn == 'yes' && $this->user_id != $this->logged_in_user_id)
                        {
                            ?>
                            <li class="active"><a href="#im">IM</a></li>
                            <?php
                        }
                    ?>
                </ul>
                <div class="cf"></div>
            </div>

            <div class="tab-content-list">
                <div class="tabs-content active">

                    <div id="events" class="content">
                        <div class="hint">
                            <div class="left fl tab-titles">
                                <ul>
                                    <?php
                                        $created_Active = "active";
                                        if ($this->tabClass == "joined")
                                        {
                                            $joined_Active = "active";
                                            $created_Active = "";
                                            $bookmarked_Active = "";
                                        }
                                        else if ($this->tabClass == "created")
                                        {
                                            $joined_Active = "";
                                            $created_Active = "active";
                                            $bookmarked_Active = "";
                                        }
                                        else if ($this->tabClass == "bookmarked")
                                        {
                                            $joined_Active = "";
                                            $created_Active = "";
                                            $bookmarked_Active = "active";
                                        }
                                    ?>
                                    <li class="<?php echo $created_Active; ?>"><a href="#created-tab" class="blu tlink">CREATED</a></li>
                                    <li class="<?php echo $joined_Active; ?>"><a href="#joined-tab" class="blu tlink">JOINED</a></li>
                                    <li class="<?php echo $bookmarked_Active; ?>"><a href="#bookmark-tab" class="blu tlink">BOOKMARKED</a></li>
                                </ul>
                            </div>
                            <div class="fr lst-h">
                                <div class="h">
                                    <div class="hright fr">
                                        <span class="blu"><strong>Hint:</strong></span> The more Events that you create with the ticket selling option turned on, the higher your rates go! Publish Events to earn more respect and popularity.
                                    </div>
                                </div>
                                <div class="h">
                                    <div class="hright fr">
                                        <span class="blu"><strong>Hint:</strong></span> Add more friends, so you couild sell more tickets and earn more money.
                                    </div>
                                </div>
                                <div class="h active">
                                    <div class="hright fr">
                                        <span class="blu"><strong>Hint:</strong></span> The more Events that you create with the ticket selling option turned on, the higher your rates go! Publish Events to earn more respect and popularity.
                                    </div>
                                </div>
                            </div>
                            <div class="cf"></div>
                        </div>

                        <?php
                            $created_Active = "active";
                            if ($this->tabClass == "joined")
                            {
                                $joined_Active = "active";
                                $created_Active = "";
                                $bookmarked_Active = "";
                            }
                            else if ($this->tabClass == "created")
                            {
                                $joined_Active = "";
                                $created_Active = "active";
                                $bookmarked_Active = "";
                            }
                            else if ($this->tabClass == "bookmarked")
                            {
                                $joined_Active = "";
                                $created_Active = "";
                                $bookmarked_Active = "active";
                            }
                        ?>

                        <div class="tab-content-list second-tab">
                            <div class="tabs-content cevent-tab <?php echo $joined_Active; ?>" id="joined-tab">
                                <div class="bm-events">
                                    <div class="line-ob"><span><strong>Joined</strong> Events</span></div>
                                </div>
                                <ul class="orderby">
                                    <li>Order by:</li>
                                    <li><a href="#"><img src="<?php echo IMAGES_PATH; ?>/o1.png" alt="o1" /></a></li>
                                    <li><a href="#"><img src="<?php echo IMAGES_PATH; ?>/o3.png" alt="o1" /></a></li>
                                </ul>
                                <div class="cf"></div>

                                <div class="events-list">
                                    <?php
                                        $__counter = 0;
                                        if (!empty($this->joinedEvents))
                                        {
                                            foreach ($this->joinedEvents as $j_key => $j_value)
                                            {
                                                $event_id = $j_value["event_id"];
                                                $event_title = $j_value["event_title"];
                                                $event_images = getEventImages($event_id);
                                                
                                                $event_end_date=  getEventDate($j_value["event_end_date"]);

                                                $event_url = $this->baseUrl("eventdetail/" . getEncryptedString($event_id));
                                                if ($__counter == 0 || $__counter % 7 == 0)
                                                {
                                                    if ($__counter != 0)
                                                        echo "</div>";

                                                    echo "<div class='joined_page " . ($__counter == 0 ? 'active' : '') . "' id='joined-page-" . (ceil($__counter / 7) + 1) . "'>";
                                                }
                                                ?>
                                                <div class="event">
                                                    <div class="ewrap">
                                                        <div class="pimg fl">
                                                            <img src="<?php echo $event_images[0]; ?>" alt="<?php echo $event_title; ?>">
                                                        </div>
                                                        <div class="details fl">
                                                            <div class="e-title">
                                                                <a class="p-name tlink" href="<?php echo $event_url; ?>"><?php echo $event_title; ?></a>
                                                                <span class="p-cates">
                                                                    <span>in</span> <a href="#" class="org tlink"><?php echo $j_value["category_name"]; ?></a> / <a class="org tlink" href="#"><?php echo $j_value["subcategory_name"]; ?></a>
                                                                </span>
                                                                <span class="p-time"><?php echo $event_end_date;?></span>
                                                            </div>
                                                            <div class="infos">
                                                                <span class="group">Group size</span><span><?php echo $j_value["event_group_size"]; ?></span>
                                                                <span>/</span><span class="org">Address</span><span><?php echo $j_value["event_address"]; ?></span>
                                                                <span class="publish fr blu"><a href="#"><?php echo ucwords($j_value["event_type"]); ?></a></span>
                                                                <div class="cf"></div>
                                                                <div class="desc fl">
                                                                    <?php echo $j_value["event_info"]; ?>
                                                                </div>
                                                                <div class="fr view">
                                                                    <a class="rbox orgbutton fr" href="<?php echo $this->baseUrl("event/index/id/" . $j_value["event_id"]); ?>"><strong>Edit</strong></a>
                                                                </div>
                                                                <div class="cf"></div>
                                                            </div>
                                                        </div>
                                                        <div class="cf"></div>
                                                    </div>
                                                </div>
                                                <?php
                                                if (count($this->joinedEvents) - 1 == $j_key)
                                                {
                                                    echo "</div>";
                                                }
                                                $__counter++;
                                            }
                                        }
                                        else
                                        {
                                            echo '<p style="padding:10px;">No joined events</p>';
                                        }
                                    ?>
                                </div>
                                <?php
//                                    if ($__counter != 0):
                                    if ($__counter > 7):
                                        ?>
                                        <!-- Pagination code for created event tab--->
                                        <div class="bottom-main">
                                            <div class="text">You are here:</div>
                                            <ul class="paging client-side joined" data-context ="joined">
                                                <li class="np" data-href="#prev"><a href="#prev">&lt; Prev.</a></li>
                                                <li class="current" data-href="#joined-page-1">
                                                    <span class="first">
                                                        <span class="last">
                                                            <span class="middle">
                                                                Page 1
                                                            </span>
                                                        </span>
                                                    </span>
                                                </li>
                                                <?php
                                                for ($_i = 1; $_i <= ceil($__counter / 7); $_i++)
                                                {

                                                    if ($_i == 1)
                                                        continue;
                                                    ?>
                                                    <li data-href="#joined-page-<?= $_i ?>"><a id="joined-anchor-<?= $_i ?>" href="#joined-page-<?= $_i ?>"><?= $_i ?></a></li>

                                                    <?php
                                                }
                                                ?>
                                                <li class="np" data-href="#next"><a href="#next">Next &gt;</a></li>
                                            </ul>
                                            <div class="cf"></div>
                                        </div>

                                        <!-- pagination ends -->
                                        <?php
                                    endif;
                                ?>

                            </div>
                            <div class="tabs-content cevent-tab <?php echo $created_Active; ?>" id="created-tab">
                                <div class="bm-events">
                                    <div class="line-ob"><span><strong>Created</strong> Events</span></div>
                                </div>
                                <ul class="orderby">
                                    <li>Order by:</li>
                                    <li><a href="#"><img src="<?php echo IMAGES_PATH; ?>/o1.png" alt="o1" /></a></li>
                                    <li><a href="#"><img src="<?php echo IMAGES_PATH; ?>/o3.png" alt="o1" /></a></li>
                                </ul>
                                <div class="cf"></div>
                                <div class="events-list">
                                    <?php
                                        $__counter = 0;
                                        if (!empty($this->createdEvents))
                                        {
                                            foreach ($this->createdEvents as $c_key => $j_value)
                                            {
                                                $event_id = $j_value["event_id"];
                                                $event_title = $j_value["event_title"];
                                                $event_images = getEventImages($event_id);
                                                $event_url = $this->baseUrl("eventdetail/" . getEncryptedString($event_id));

                                                if ($__counter == 0 || $__counter % 7 == 0)
                                                {
                                                    if ($__counter != 0)
                                                        echo "</div>";

                                                    echo "<div class='created_page " . ($__counter == 0 ? 'active' : '') . "' id='created-page-" . (ceil($__counter / 7) + 1) . "'>";
                                                }
                                                ?>
                                                <div class="event">
                                                    <div class="ewrap">
                                                        <div class="pimg fl">
                                                            <img src="<?php echo $event_images[0]; ?>" alt="<?php echo $event_title; ?>">
                                                        </div>
                                                        <div class="details fl">
                                                            <div class="e-title">
                                                                <a class="p-name tlink" href="<?php echo $event_url; ?>"><?php echo $event_title; ?></a>
                                                                <span class="p-cates">
                                                                    <span>in</span> <a href="#" class="org tlink"><?php echo $j_value["category_name"]; ?></a> / <a class="org tlink" href="#"><?php echo $j_value["subcategory_name"]; ?></a>
                                                                </span>
                                                                <span class="p-time">14 Oct 2012 / 15:00 EEST</span>
                                                            </div>
                                                            <div class="infos">
                                                                <span class="group">Group size</span><span><?php echo $j_value["event_group_size"]; ?></span>
                                                                <span>/</span><span class="org">Address</span><span><?php echo $j_value["event_address"]; ?></span>
                                                                <span class="publish fr blu"><a href="#"><?php echo ucwords($j_value["event_type"]); ?></a></span>
                                                                <div class="cf"></div>
                                                                <div class="desc fl">
                                                                    <?php echo $j_value["event_info"]; ?>
                                                                </div>
                                                                <div class="fr view">
                                                                    <a class="rbox orgbutton fr" href="<?php echo $this->baseUrl("event/index/id/" . $j_value["event_id"]); ?>"><strong>Edit</strong></a>
                                                                </div>
                                                                <div class="cf"></div>
                                                            </div>
                                                        </div>
                                                        <div class="cf"></div>
                                                    </div>
                                                </div>
                                                <?php
                                                if (count($this->createdEvents) - 1 == $c_key)
                                                {
                                                    echo "</div>";
                                                }
                                                $__counter++;
                                            }
                                        }
                                        else
                                        {
                                            echo '<p style="padding:10px;">No created events</p>';
                                        }
                                    ?>
                                </div>
                                <?php
//                                    if ($__counter != 0):
                                    if ($__counter > 7):
                                        ?>
                                        <!-- Pagination code for created event tab--->
                                        <div class="bottom-main">
                                            <div class="text">You are here:</div>
                                            <ul class="paging created client-side" data-context ="created">
                                                <li class="np" data-href="#prev"><a href="#prev">&lt; Prev.</a></li>
                                                <li class="current" data-href="#created-page-1">
                                                    <span class="first">
                                                        <span class="last">
                                                            <span class="middle">
                                                                Page 1
                                                            </span>
                                                        </span>
                                                    </span>
                                                </li>
                                                <?php
                                                for ($_i = 1; $_i <= ceil($__counter / 7); $_i++)
                                                {

                                                    if ($_i == 1)
                                                        continue;
                                                    ?>
                                                    <li data-href="#created-page-<?= $_i ?>"><a id="created-anchor-<?= $_i ?>" href="#created-page-<?= $_i ?>"><?= $_i ?></a></li>

                                                    <?php
                                                }
                                                ?>
                                                <li class="np" data-href="#next"><a href="#next">Next &gt;</a></li>
                                            </ul>
                                            <div class="cf"></div>
                                        </div>

                                        <!-- pagination ends -->
                                        <?php
                                    endif;
                                ?>
                            </div>
                            <div class="tabs-content <?php echo $bookmarked_Active; ?>" id="bookmark-tab">
                                <div class="bm-events">
                                    <div class="line-ob"><span><strong>Bookmarked</strong> Events</span></div>
                                </div>
                                <ul class="orderby">
                                    <li>Order by:</li>
                                    <li><a href="#"><img src="<?php echo IMAGES_PATH; ?>/o1.png" alt="o1" /></a></li>
                                    <li><a href="#"><img src="<?php echo IMAGES_PATH; ?>/o3.png" alt="o1" /></a></li>
                                </ul>
                                <div class="cf"></div>
                                <ul class="celebrity-events">

                                    <?php
                                        $__counter = 0;
                                        if (!empty($this->bookmarkedEvents))
                                        {
                                            foreach ($this->bookmarkedEvents as $b_key => $b_value)
                                            {
                                                $event_id = $j_value["event_id"];
                                                $enc_event_id = getEncryptedString($event_id);
                                                $event_title = $j_value["event_title"];
                                                $event_images = getEventImages($event_id);

                                                $event_url = $this->baseUrl("eventdetail/" . getEncryptedString($event_id));
                                                if ($__counter == 0 || $__counter % 16 == 0)
                                                {
                                                    if ($__counter != 0)
                                                        echo "</ul></div>";

                                                    echo "<div class='bookmarked_page " . ($__counter == 0 ? 'active' : '') . "' id='bookmarked-page-" . (ceil($__counter / 16) + 1) . "'><ul>";
                                                }
                                                ?>
                                                <li id="<?php echo $enc_event_id; ?>">
                                                    <a href="#"><img src="<?php echo $event_images[0]; ?>" alt="<?php echo $event_title; ?>"></a>
                                                    <p class="etitle"><a href="<?php echo $event_url; ?>" class="tlink"><?php echo $event_title; ?></a></p>
                                                    <div class="info">
                                                        div class="link"><a href="<?php echo $event_url; ?>"><?php echo getUrl($event_url); ?></a></div>
                                                    <div class="date">12 Sept 2012</div>
                                                    <div class="clock"><?php echo date("g:i a", strtotime($b_value["event_time"])); ?></div>
                                                    <div class="spot remove-bookmark" rel="<?php echo $enc_event_id; ?>">Remove bookmark</div>
                                                    <a href="#" class="pin"></a>
                                                </li>
                                                <?php
                                                if (count($this->bookmarkedEvents) - 1 == $b_key)
                                                {
                                                    echo "</ul></div>";
                                                }
                                                $__counter++;
                                            }
                                        }
                                        else
                                        {
                                            echo '<p style="padding:10px;">No bookmarked events</p>';
                                        }
                                    ?>
                                </ul>
                                <div class="cf"></div>
                                <p><br /></p>
                                <?php
//                                    if($__counter != 0):
                                    if ($__counter > 16):
                                        ?>
                                        <!-- Pagination code for created event tab--->
                                        <div class="bottom-main">
                                            <div class="text">You are here:</div>
                                            <ul class="paging client-side bookmarked" data-context ="bookmarked">
                                                <li class="np" data-href="#prev"><a href="#prev">&lt; Prev.</a></li>
                                                <li class="current" data-href="#bookmarked-page-1">
                                                    <span class="first">
                                                        <span class="last">
                                                            <span class="middle">
                                                                Page 1
                                                            </span>
                                                        </span>
                                                    </span>
                                                </li>
                                                <?php
                                                for ($_i = 1; $_i <= ceil($__counter / 16); $_i++)
                                                {

                                                    if ($_i == 1)
                                                        continue;
                                                    ?>
                                                    <li data-href="#bookmarked-page-<?= $_i ?>"><a id="bookmarked-anchor-<?= $_i ?>" href="#bookmarked-page-<?= $_i ?>"><?= $_i ?></a></li>

                                                    <?php
                                                }
                                                ?>
                                                <li class="np" data-href="#next"><a href="#next">Next &gt;</a></li>
                                            </ul>
                                            <div class="cf"></div>
                                        </div>

                                        <!-- pagination ends -->
                                        <?php
                                    endif;
                                ?>
                            </div>
                        </div>
                    </div>

                    <div id="ratings" class="content" style="">
                        <div class="hint">
                            <div class="left fl tab-titles">
                                <ul class="rate-reviews tab-menu-inner">
                                    <li class="active">
                                        <span class="t"><span class="blu"><strong>My Rates</strong></span> Rates and comments I have given to people and events</span>
                                        <div  class="sw ra">
                                            <a href="#rate-tab">&nbsp;</a>
                                        </div>
                                    </li>
                                    <li>
                                        <span class="t"><span class="blu"><strong>My Reviews</strong></span> Rates and comments, that other have given to me</span>
                                        <div  class="sw re">
                                            <a href="#reviews-tab">&nbsp;</a>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                            <div class="fr lst-h">
                                <div class="h active">
                                    <div class="hright fr">
                                        <span class="blu"><strong>Hint:</strong></span>
                                        Comment more so you could <br />
                                        receive more rates and comments<br />
                                        from your fiends. 
                                    </div>
                                </div>
                                <div class="h">
                                    <div class="hright fr">
                                        <span class="blu"><strong>Hint:</strong></span>
                                        Comment more so you could <br />
                                        receive more rates and comments<br />
                                        from your fiends. 
                                    </div>
                                </div>
                            </div>
                            <div class="cf"></div>
                        </div>
                        <div class="tab-content-list second-tab">
                            <div class="tabs-content rate-tab active content" id="rate-tab">
                                <div class="bm-events">
                                    <div class="line-ob"><span><strong>My Rates</strong> list</span></div>
                                </div>
                                <ul class="orderby">
                                    <li>Order by:</li>
                                    <li><a href="#"><img src="<?php echo IMAGES_PATH; ?>/o1.png" alt="o1" /></a></li>
                                </ul>
                                <div class="cf"></div>
                                <ul class="rates-list">

                                </ul>
                                <div class="cf"></div>
                                <p><br /><br /></p>
                                <div id="myrates-pagination">
                                    <?php
                                        echo $this->paginationControl($this->paginator1, 'Sliding', 'pagination/ajaxpagination.phtml', array('type_of_data' => 'rating'));
                                    ?>
                                </div>
                            </div>
                            <div class="tabs-content reviews-tab" id="reviews-tab">
                                <div class="bm-events">
                                    <div class="line-ob"><span><strong>My Reviews</strong> list</span></div>
                                </div>
                                <ul class="orderby">
                                    <li>Order by:</li>
                                    <li><a href="#"><img src="<?php echo IMAGES_PATH; ?>/o1.png" alt="o1" /></a></li>
                                </ul>
                                <div class="cf"></div>
                                <?php
                                    if ($this->isLoggedIn == 'yes' && $this->user_id != $this->logged_in_user_id)
                                    {
                                        ?>    

                                        <div id="commentBlock" style="padding:0 7px;">  
                                            <img src="<?php echo is_file(ROOT_PATH . "/" . MEMBER_IMAGE_PATH . "/" . $this->logged_in_user_id . ".jpg") ? $this->baseUrl(MEMBER_IMAGE_PATH . "/" . $this->logged_in_user_id . ".jpg") : $this->baseUrl(MEMBER_NO_IMAGE_FILE); ?>" alt="img" class="fl" width="32" height="32"/>
                                            <div class="details fl">
                                                <div class="e-title">
                                                    <a class="p-name tlink" href="#"><?php echo $this->logged_in_first_name . " " . $this->logged_in_last_name; ?></a>
                                                </div>
                                                <form method ="post" name="profileComment" id="profileComment" onsubmit="return validateForm('profile_comment', this)">

                                                    <textarea class="comm brnd44 commbox" onfocus="if (this.value == this.title)
                                                            this.value = '';
                                                        this.style.fontStyle = 'normal';" onblur="if (this.value == '') {
                                                            this.value = this.title;
                                                            this.style.fontStyle = 'italic';
                                                        }" title="Write a comment ..." name="comments">Write a comment ...</textarea>
                                                    <p><br /></p>
                                                    <p><button type="submit" class="rbox orgbutton" name="sbmt">Send</button></p>
                                                </form>
                                            </div>
                                            <div class="cf"></div>
                                        </div> 
                                        <?php
                                    }
//                              
                                ?>
                                <ul class="reviews-list">

                                </ul>
                                <div class="cf"></div>
                                <p><br /><br /></p>
                                <div id="myreview-pagination">
                                    <?php
                                        echo $this->paginationControl($this->paginator, 'Sliding', 'pagination/ajaxpagination.phtml', array('type_of_data' => 'review'));
                                    ?>
                                </div>        
                            </div>

                        </div>
                    </div>

                    <?php
                        if ($this->isLoggedIn == 'yes' && $this->user_id != $this->logged_in_user_id)
                        {
                            ?>

                            <div id="im" class="content friend-list" style="padding: 10px;">
                                <h1 class="im-title">Your <span class="blu">IM</span></h1>
                                <form class="outbox" name="myform" id="myform" onsubmit="return validateForm('reply', this);">
                                    <p><textarea class="radius area commbox"  name ="comments" title="Write a comment ..." onfocus="this.style.borderColor = '#1996d4';
                                                        if (this.value == this.title)
                                                            this.value = '';" onblur="this.style.borderColor = '#cfcfcf';
                                                        if (this.value == '') {
                                                            this.value = this.title;
                                                            this.style.fontStyle = 'italic';
                                                        }" style="border-color: rgb(207, 207, 207);">Write a comment ...</textarea></p>
                                    <p class="note">1000 characters max</p>
                                    <p><br /></p>
                                    <div class="fl">
            <!--                            <a href="#" class="bluefbutton fl"><strong>Send IM</strong></a>-->
                                        <!--<button type="submit" class="bluefbutton fl"><strong>Send IM</strong></button>-->
                                        <input type="hidden" class="message_to" data-uid ="" value="<?php echo $this->user_id; ?>" name="message_to">
                                        <input type="submit" class="bluefbutton fl" name="sbmt" value="Send IM"/>
                                    </div>
                                </form>
                                <div class="fr pass-message"><a href="<?php echo $this->baseUrl("message"); ?>" class="org tlink">View Past messages with <?php echo $this->first_name . " " . $this->last_name; ?></a></div>
                                <div class="cf"></div>
                            </div>

                            <?php
                        }
                    ?>    
                </div>
            </div>

            <div class="cf"></div>
        </div>
        <div class="right">
            <?php
                if ($this->isLoggedIn == "yes")
                {
                    ?>
                    <div class="rtitle">
                        Post
                    </div>
                    <div class="box post-box">
                        <a href="#" class="rbox sfebutton"><span class="img"><img src="<?php echo IMAGES_PATH; ?>/adv-icon.png" alt="event" /></span><span>Search for <br/><strong>Events</strong></span></a>
                        <a href="#" class="rbox cebutton"><span class="img"><img src="<?php echo IMAGES_PATH; ?>/event-icon.png" alt="event" /></span><span>Create <strong>Event</strong></span></a>
                    </div>
                    <?php
                }
            ?>
            <div class="rtitle ft-title">
                Friends Tied
            </div>
            <div class="box friend-tied">
                <?php
                    if (!empty($this->friendList))
                    {
                        ?>
                        <ul class="fl">
                            <?php
                            foreach ($this->friendList as $f_key => $f_value)
                            {
                                $friend_user_id = $f_value["user_id"];
                                $friend_user_full_name = $f_value["user_first_name"] . " " . $f_value["user_last_name"];
                                $friend_user_img = getUserImage($friend_user_id);
                                $friend_user_link = getUrl("profile/publicprofile/$friend_user_id");

                                echo '<li><a href="' . $friend_user_link . '"><img src="' . $friend_user_img . '" alt="' . $friend_user_full_name . '" title="' . $friend_user_full_name . '" class="profile-friend-img"/></a></li>';
                            }
                            ?>
                        </ul>
                        <div class="cf"></div>

                        <?php
                    }
                    else
                    {
                        echo '<div class="view-more">No friends tied yet</div>';
                    }
                ?>
                <div class="cf"></div>
                <div class="view-more">
                    <a href="<?php echo $this->url(array("controller" => 'friend', 'action' => 'friendlist', 'user_id' => getEncryptedString($this->user_id)), 'friend_list', true); ?>" class="tlink blu">View more +</a>
                </div>  
            </div>
            <?php
                echo $this->partial("ads.phtml", array("ads_count" => "2"));
            ?>
        </div>
        <div class="cf"></div>
    </div>
</div>
<script>
                                            var rate_user_id = $(".rating").attr("id");
                                            var rate_stars = $(".rating").attr("rel");
                                            var rate_ajax_url = "<?php echo $this->baseUrl("rate-user/"); ?>" + rate_user_id;
                                            $('.rating').rating(rate_ajax_url, {maxvalue: <?php echo RATING_STARS_MAX; ?>, curvalue: rate_stars});
</script>

<script id="my-review-list" type="text/html">
    {{#myreview}}
    <li>
    <div class="ls fl">
    <div style="width: 255px;">Rated {{rating}}
    <div class="cf"></div>
    </div>
    <p class="time">Posted on 
    <span class="blu">{{posted_date}}</span>
    </p>
    </div>
    <div class="rs fr">
    <img src="{{avatar}}" alt="img" class="fr" width="32" height="32"/>
    <div class="if fr">
    <p>reviewer: <span class="blu n">
    <a href="{{profile_link}}">{{reviewer_name}}</a>
    </span>
    </p>
    <p>Event: <span class="blu">Lorem ipsum event title the commnet is for</span></p>
    </div>
    </div>
    <div class="cf"></div>
    <div class="rc">
    <p>{{comments}}</p>
    </div>
    </li>
    {{/myreview}}
    {{#noreview}}
    <li style="display:block;width:100%;">
    No comments received yet
    </li>
    {{/noreview}}
</script>



<script id="myrating-template" type="text/html">
    {{#myreview}}
    <li>
    <img src="{{avatar}}" alt="img" class="fl" width="32" height="32"/>
    <div class="details fl">
    <div class="e-title">
    <a class="p-name tlink" href="#">SOME TITLE,</a>
    <span class="p-cates">
    <span>in</span> <a href="#" class="org tlink">Football</a> / <a class="org tlink" href="#">American</a>
    </span>
    <span class="p-time">14 Oct 2012 / 15:00 EEST</span>
    </div>
    <div class="infos">
    <div class="grs">
    <span class="group org">Group size</span><span> 50</span>
    <span>&nbsp;&nbsp;/&nbsp;&nbsp;</span><span class="org">Address</span><span> &nbsp;Some Awesomeâ€� Str, 1</span>
    <span class="publish fr blu"><a href="#">Public</a></span>
    </div>
    <div class="cf"></div>
    </div>
    <div class="desc fl">
    <p>{{comments}}</p>
    </div>
    <div class="cf"></div>
    </div>
    </li>
    {{/myreview}}
    {{#noreview}}
    <li style="display:block;width:100%;">
    No comments given yet
    </li>
    {{/noreview}}
</script>

<script type="text/javascript">

    (function($) {
        $('.reviews-list').mask("Loading...");

        $.Mustache.options.warnOnMissingTemplates = true;

        // Loading templates embedded in the DOM. (HTML)
        $(function() {
            $.Mustache.addFromDom();

            // Render out one of the templates.
            $('.reviews-list').empty().html($.Mustache.render('my-review-list', <?php echo $this->mymustacheData; ?>));
            $('.rates-list').empty().html($.Mustache.render('myrating-template', <?php echo $this->reviewMustacheData; ?>));


            $('.reviews-list').unmask();
        });
    })(jQuery);
</script>